package com.bocloud.cmp.entity.resource;

import java.util.Date;
import java.util.List;

import org.springframework.format.annotation.DateTimeFormat;

import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Table("vdc")
public class Vdc extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id;
	@Column("uuid")
	private String uuid;
	@Column("vendor_id")
	private Long vendorId; // 云供应商ID
	@IgnoreAll
	private String vendorName; // 云供应商名称
	@Column("gmt_expired")
	@JsonSerialize(using = DateSerializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date gmtExpired;// 过期时间
	@Column("cpu_total")
	private Long cpuTotal;
	@Column("mem_total")
	private Long memTotal;
	@Column("disk_total")
	private Long diskTotal;
	@Column("cpu_used")
	private Long cpuUsed;
	@Column("mem_used")
	private Long memUsed;
	@Column("disk_used")
	private Long diskUsed;
	@Column("vdc_val")
	private String vdcVal;
	@IgnoreAll
	private List<Cluster> clusters;
	@IgnoreAll
	private List<HostSystem> hosts;
	@IgnoreAll
	private List<DataStore> stores;
	@IgnoreAll
	private List<Network> networks;

	public List<Network> getNetworks() {
		return networks;
	}

	public void setNetworks(List<Network> networks) {
		this.networks = networks;
	}

	/**
	 * @return the stores
	 */
	public List<DataStore> getStores() {
		return stores;
	}

	/**
	 * @param stores
	 *            the stores to set
	 */
	public void setStores(List<DataStore> stores) {
		this.stores = stores;
	}

	/**
	 * @return the hosts
	 */
	public List<HostSystem> getHosts() {
		return hosts;
	}

	/**
	 * @param hosts
	 *            the hosts to set
	 */
	public void setHosts(List<HostSystem> hosts) {
		this.hosts = hosts;
	}

	/**
	 * @return the clusters
	 */
	public List<Cluster> getClusters() {
		return clusters;
	}

	/**
	 * @param clusters
	 *            the clusters to set
	 */
	public void setClusters(List<Cluster> clusters) {
		this.clusters = clusters;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the uuid
	 */
	public String getUuid() {
		return uuid;
	}

	/**
	 * @param uuid
	 *            the uuid to set
	 */
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	/**
	 * @return the vendorId
	 */
	public Long getVendorId() {
		return vendorId;
	}

	/**
	 * @param vendorId
	 *            the vendorId to set
	 */
	public void setVendorId(Long vendorId) {
		this.vendorId = vendorId;
	}

	/**
	 * @return the vendorName
	 */
	public String getVendorName() {
		return vendorName;
	}

	/**
	 * @param vendorName
	 *            the vendorName to set
	 */
	public void setVendorName(String vendorName) {
		this.vendorName = vendorName;
	}

	/**
	 * @return the gmtExpired
	 */
	public Date getGmtExpired() {
		return gmtExpired;
	}

	/**
	 * @param gmtExpired
	 *            the gmtExpired to set
	 */
	public void setGmtExpired(Date gmtExpired) {
		this.gmtExpired = gmtExpired;
	}

	/**
	 * @return the cpuTotal
	 */
	public Long getCpuTotal() {
		return cpuTotal;
	}

	/**
	 * @param cpuTotal
	 *            the cpuTotal to set
	 */
	public void setCpuTotal(Long cpuTotal) {
		this.cpuTotal = cpuTotal;
	}

	/**
	 * @return the memTotal
	 */
	public Long getMemTotal() {
		return memTotal;
	}

	/**
	 * @param memTotal
	 *            the memTotal to set
	 */
	public void setMemTotal(Long memTotal) {
		this.memTotal = memTotal;
	}

	/**
	 * @return the diskTotal
	 */
	public Long getDiskTotal() {
		return diskTotal;
	}

	/**
	 * @param diskTotal
	 *            the diskTotal to set
	 */
	public void setDiskTotal(Long diskTotal) {
		this.diskTotal = diskTotal;
	}

	/**
	 * @return the cpuUsed
	 */
	public Long getCpuUsed() {
		return cpuUsed;
	}

	/**
	 * @param cpuUsed
	 *            the cpuUsed to set
	 */
	public void setCpuUsed(Long cpuUsed) {
		this.cpuUsed = cpuUsed;
	}

	/**
	 * @return the memUsed
	 */
	public Long getMemUsed() {
		return memUsed;
	}

	/**
	 * @param memUsed
	 *            the memUsed to set
	 */
	public void setMemUsed(Long memUsed) {
		this.memUsed = memUsed;
	}

	/**
	 * @return the diskUsed
	 */
	public Long getDiskUsed() {
		return diskUsed;
	}

	/**
	 * @param diskUsed
	 *            the diskUsed to set
	 */
	public void setDiskUsed(Long diskUsed) {
		this.diskUsed = diskUsed;
	}

	/**
	 * @return the vdcVal
	 */
	public String getVdcVal() {
		return vdcVal;
	}

	/**
	 * @param vdcVal
	 *            the vdcVal to set
	 */
	public void setVdcVal(String vdcVal) {
		this.vdcVal = vdcVal;
	}

	/**
	 * @param createrId
	 * @param ownerId
	 * @param menderId
	 * @param id
	 * @param uuid
	 * @param vendorId
	 * @param vendorName
	 * @param gmtExpired
	 * @param cpuTotal
	 * @param memTotal
	 * @param diskTotal
	 * @param cpuUsed
	 * @param memUsed
	 * @param diskUsed
	 */
	public Vdc(Long createrId, Long ownerId, Long menderId, Long id, String uuid, Long vendorId, String vendorName,
			Date gmtExpired, Long cpuTotal, Long memTotal, Long diskTotal, Long cpuUsed, Long memUsed, Long diskUsed,
			String vdcVal) {
		super(createrId, ownerId, menderId);
		this.id = id;
		this.uuid = uuid;
		this.vendorId = vendorId;
		this.vendorName = vendorName;
		this.gmtExpired = gmtExpired;
		this.cpuTotal = cpuTotal;
		this.memTotal = memTotal;
		this.diskTotal = diskTotal;
		this.cpuUsed = cpuUsed;
		this.memUsed = memUsed;
		this.diskUsed = diskUsed;
		this.vdcVal = vdcVal;
	}

	/**
	 * 
	 */
	public Vdc() {
		super();
	}

	public Vdc(Long createrId, Long ownerId, Long menderId, String name, String status, Boolean deleted, String props,
			String remark) {
		super(createrId, ownerId, menderId, name, status, deleted, props, remark);
	}

	public Vdc(Long createrId, Long ownerId, Long menderId) {
		super(createrId, ownerId, menderId);
	}

	public void preSave(Long createrId, Long menderId, Long vendorId) {
		this.setCreaterId(createrId);
		this.setMenderId(menderId);
		this.setVendorId(vendorId);
	}

}
